package geoway.bmf.keycloak.controller;

import geoway.bmf.keycloak.dto.LoginDto;
import geoway.bmf.keycloak.service.KeyCloakRemoteService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yrt
 * @description
 * @date 2022/12/3 14:21
 */

@RestController
@RequestMapping("login")
public class KeyCloakLoginController {

    private final KeyCloakRemoteService keyCloakRemoteService;

    public KeyCloakLoginController(KeyCloakRemoteService keyCloakRemoteService) {
        this.keyCloakRemoteService = keyCloakRemoteService;
    }

    @PostMapping("userLogin")
    public String userLogin(@RequestBody LoginDto loginDto){
        String login = keyCloakRemoteService.userLogin(loginDto);
        return login;
    }

}
